package com.book.bookshop.web;

import com.book.bookshop.entity.Fenlei;
import com.book.bookshop.service.FenleiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/*
    2022/5/5 12:48
    @author ZW
    Project Name:book-shop
     
*/
@Controller
@RequestMapping("/fenlei")
public class FenleiController {
    @Autowired
    private FenleiService fenleiService;

    @RequestMapping("/list")
    @ResponseBody
    public List<Fenlei> fenleilist(){
        List<Fenlei> fenleis = fenleiService.selectList();

        return fenleis;
    }

    // @RequestMapping("/list")
    // public String fenleilist(Model model){
    //     List<Fenlei> fenleis = fenleiService.selectList();
    //     model.addAttribute("fenleis",fenleis);
    //     return "index";
    // }
}
